
  // 获取作者推荐
  $.get('/my/article').then(res => {
    if (res.status == 1 && res.message === 'token失效或错误') {
        location.href = '/login.html'
        return layer.msg('token失效或错误')
    }
    $('.personList').html(template('article-tmp', {
        data: res.data
    }))
})


// 文章列表
$.get('/my/info').then(res => {
    if (res.status == 1 && res.message === 'token失效或错误') {
        location.href = '/login.html'
    }
    $('.article-box').html(template('tmp-article-wrapper', {
        data: res.data
    }))
})


const H = 340
function removeClass(e) {
    e.removeClass('autograph-top').removeClass('autograph-left').removeClass('autograph-bottom')
    e.hide()
}
let id, dl
$('.article-box').on('mouseover', '.article-wrapper .author', function (event) {
    if (id !== null && dl === this) {
        clearTimeout(id)
        return
    } else {
        if (dl) {
            clearTimeout(id)
            const e = $(dl).parents('.article-wrapper').find('.autograph')
            removeClass(e)
        }
        dl = this
        const e = $(this).parents('.article-wrapper').find('.autograph')
        const h = $(this).offset().top
        const s = $(document).scrollTop()
        const x = h - s
        if (x > H) {
            e.addClass('autograph-top')
        } else if (window.innerHeight - x > H) {
            e.addClass('autograph-bottom')
        } else {
            e.addClass('autograph-left')
        }
        e.show()
    }
})
$('.article-box').on('mouseleave', '.author', function (event) {
    const e = $(dl).parents('.article-wrapper').find('.autograph')
    id = setTimeout(() => {
        removeClass(e)
        id = null
        dl = null
    }, 300)
})
